<template>
  <div class="home-container">
    <div class="welcome-section">
      <h1>欢迎使用盼寻密友！</h1>
      <p>选择左侧联系人开始聊天</p>
    </div>
    <div class="online-users">
      <div class="online-users-header">
        <h2>在线用户 (15)</h2>
      </div>
      <div class="online-users-list">
        <div class="user-item" v-for="user in onlineUsers" :key="user.id">
          <div class="user-avatar-placeholder"></div>
          <div class="user-info">
            <div class="user-name">{{ user.name }}</div>
            <div class="user-status">{{ user.status }}</div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: 'Home',
  data() {
    return {
      onlineUsers: [
        { id: 1, name: '张三', status: '在线' },
        { id: 2, name: '李四', status: '在线' },
        { id: 3, name: '王五', status: '在线' },
        { id: 4, name: '赵六', status: '在线' },
        { id: 5, name: '钱七', status: '在线' },
        { id: 6, name: '孙八', status: '在线' },
        { id: 7, name: '周九', status: '在线' },
        { id: 8, name: '吴十', status: '在线' },
        { id: 9, name: '郑一', status: '在线' },
        { id: 10, name: '王二', status: '在线' },
        { id: 11, name: '冯三', status: '在线' },
        { id: 12, name: '陈四', status: '在线' },
        { id: 13, name: '褚五', status: '在线' },
        { id: 14, name: '卫六', status: '在线' },
        { id: 15, name: '蒋七', status: '在线' }
      ]
    };
  }
};
</script>

<style scoped>
.home-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: var(--spacing-md);
  box-sizing: border-box;
}

.welcome-section {
  text-align: center;
  padding: calc(3 * var(--spacing-xl) + var(--spacing-lg)) 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border-radius: 20px;
  margin: 20px;
}

.welcome-section h1 {
  font-size: 24px;
  color: white;
  margin-bottom: var(--spacing-md);
}

.welcome-section p {
  font-size: 16px;
  color: rgba(255, 255, 255, 0.9);
}

.online-users {
  background: rgba(255, 255, 255, 0.95);
  border-radius: 20px;
  padding: var(--spacing-md);
  margin-top: var(--spacing-md);
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(10px);
}

.online-users-header h2 {
  font-size: 18px;
  color: #333;
  margin-top: 0;
  margin-bottom: var(--spacing-sm);
}

.online-users-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: var(--spacing-sm);
}

.user-item {
  display: flex;
  align-items: center;
  padding: var(--spacing-sm);
  background: rgba(255, 255, 255, 0.95);
  border-radius: 10px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
}

.user-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
  /* 添加悬停效果类 */
  /* list-item-hover-effect */
}

.user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  margin-right: var(--spacing-sm);
  object-fit: cover;
}

.user-info {
  flex: 1;
}

.user-name {
  font-size: 14px;
  font-weight: 500;
  color: #333;
  margin-bottom: var(--spacing-xs);
}

.user-status {
  font-size: 12px;
  color: #666;
}

.user-avatar-placeholder {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  margin-right: var(--spacing-sm);
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 18px;
}

/* 移动端优化 */
@media (max-width: 767px) {
  .home-container {
    padding: var(--spacing-sm);
  }
  
  .welcome-section {
    padding: var(--spacing-xl) 0;
    margin: 10px;
    border-radius: 15px;
  }
  
  .welcome-section h1 {
    font-size: 20px;
    margin-bottom: var(--spacing-sm);
  }
  
  .welcome-section p {
    font-size: 14px;
  }
  
  .online-users {
    padding: var(--spacing-sm);
    margin-top: var(--spacing-sm);
    border-radius: 15px;
  }
  
  .online-users-header h2 {
    font-size: 16px;
    margin-bottom: var(--spacing-xs);
  }
  
  .online-users-list {
    grid-template-columns: 1fr;
    gap: var(--spacing-xs);
  }
  
  .user-item {
    padding: var(--spacing-xs);
  }
  
  .user-avatar-placeholder {
    width: 30px;
    height: 30px;
    font-size: 14px;
  }
  
  .user-name {
    font-size: 13px;
    margin-bottom: var(--spacing-xs);
  }
  
  .user-status {
    font-size: 11px;
  }
}
</style>